package com.wanjia.estate.service.httpservice;

import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.nkstar.lsjkclient.NKlsjkClient;
import com.nkstar.lsjkclient.bean.nklsjkResponse;
import com.nkstar.lsjkclient.exception.NKLsjkException;
import com.wanjia.estate.pojo.tax.*;
import com.wanjia.estate.properties.HttpRequestProperties;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.http.RequestEntity;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;

@Slf4j
@Service
public class TaxHttpService extends AbstractHttpService {

    @Setter(onMethod_ = @Autowired)
    private HttpRequestProperties properties;

    private NKlsjkClient client = new NKlsjkClient();

    public A001.Response a001(A001.RequestOne request) {
        log.debug("request body: {}", JSONUtil.toJsonStr(request));

        nklsjkResponse response1 = client.getResponse("ZLFRWJS", toXml(request));
        log.debug("response code: {}", response1.getResponseCode());
        log.debug("response data: {}", response1.getResponseData());

        return fromXml(response1.getResponseData(), A001.Response.class);
    }

    public A003.Response a003(A003.RequestThree request) {
        log.debug("request body: {}", JSONUtil.toJsonStr(request));

        nklsjkResponse response1 = client.getResponse("RWZT", toXml(request));
        log.debug("response code: {}", response1.getResponseCode());
        log.debug("response data: {}", response1.getResponseData());

        return fromXml(response1.getResponseData(), A003.Response.class);
    }

    public A004.Response a004(A004.RequestFour request) {
        log.debug("request body: {}", JSONUtil.toJsonStr(request));

        nklsjkResponse response1 = client.getResponse("ZLFSKXXHQ", toXml(request));
        log.debug("response code: {}", response1.getResponseCode());
        log.debug("response data: {}", response1.getResponseData());

        return fromXml(response1.getResponseData(), A004.Response.class);
    }


    public A006.Response a006(A006.RequestSix request) {
//        log.debug("request body: {}", JSONUtil.toJsonStr(request));

        nklsjkResponse response1 = client.getResponse("YXZLXXJS", toXml(request));

        log.debug("response code: {}", response1.getResponseCode());
        log.debug("response data: {}", response1.getResponseData());

        return fromXml(response1.getResponseData(), A006.Response.class);
    }

    public A010.Response a010(A010.RequestTen request) {
        log.debug("request body: {}", JSONUtil.toJsonStr(request));

        nklsjkResponse response1 = client.getResponse("SBZTXX", toXml(request));
        log.debug("response code: {}", response1.getResponseCode());
        log.debug("response data: {}", response1.getResponseData());

        return fromXml(response1.getResponseData(), A010.Response.class);
    }

    public A011.Response a011(A011.RequestEleven request) {
        log.debug("request body: {}", JSONUtil.toJsonStr(request));

        nklsjkResponse response1 = client.getResponse("BDCDYHHX", toXml(request));
        log.debug("response code: {}", response1.getResponseCode());
        log.debug("response data: {}", response1.getResponseData());

        return fromXml(response1.getResponseData(), A011.Response.class);
    }

    public A014.Response a014(A014.RequestFourteen request) {
        log.debug("request body: {}", JSONUtil.toJsonStr(request));

        nklsjkResponse response1 = client.getResponse("FCJYSBXX", toXml(request));
        log.debug("response code: {}", response1.getResponseCode());
        log.debug("response data: {}", response1.getResponseData());

        return fromXml(response1.getResponseData(), A014.Response.class);
    }

    public A015.Response a015(A015.RequestFifteen request) {
        log.debug("request body: {}", JSONUtil.toJsonStr(request));

        nklsjkResponse response1 = client.getResponse("FCJYSBXXQR", toXml(request));
        log.debug("response code: {}", response1.getResponseCode());
        log.debug("response data: {}", response1.getResponseData());

        return fromXml(response1.getResponseData(), A015.Response.class);
    }

    public A017.Response a017(A017.RequestSeventeen request) {
        log.debug("request body: {}", JSONUtil.toJsonStr(request));

        nklsjkResponse response1 = client.getResponse("QUERYfCJYYJKLIST", toXml(request));
        log.debug("response code: {}", response1.getResponseCode());
        log.debug("response data: {}", response1.getResponseData());

        return fromXml(response1.getResponseData(), A017.Response.class);
    }

    public A018.Response a018(A018.RequestEighteen request) {
        log.debug("request body: {}", JSONUtil.toJsonStr(request));

        nklsjkResponse response1 = client.getResponse("GETFCJYEWMJKXX", toXml(request));
        log.debug("response code: {}", response1.getResponseCode());
        log.debug("response data: {}", response1.getResponseData());

        return fromXml(response1.getResponseData(), A018.Response.class);
    }
    public A019.Response a019(A019.RequestNineteen request) {
        log.debug("request body: {}", JSONUtil.toJsonStr(request));

        nklsjkResponse response1 = client.getResponse("QUERYEWMJKXX", toXml(request));
        log.debug("response code: {}", response1.getResponseCode());
        log.debug("response data: {}", response1.getResponseData());

        return fromXml(response1.getResponseData(), A019.Response.class);
    }


    public A020.Response a020(A020.RequestTwenty request) {
        log.debug("request body: {}", JSONUtil.toJsonStr(request));

        nklsjkResponse response1 = client.getResponse("QSWSPZHQ", toXml(request));
        log.debug("response code: {}", response1.getResponseCode());
        log.debug("response data: {}", response1.getResponseData());

        return fromXml(response1.getResponseData(), A020.Response.class);
    }

    public A023.Response a023(A023.RequestTwentyThree request) {
        log.debug("request body: {}", JSONUtil.toJsonStr(request));

        nklsjkResponse response1 = client.getResponse("FCJYSB", toXml(request));
        log.debug("response code: {}", response1.getResponseCode());
        log.debug("response data: {}", response1.getResponseData());

        return fromXml(response1.getResponseData(), A023.Response.class);
    }

}
